Vercel
API ReferenceMessages

Send Message

Sends a new message to an existing chat. Blocks until the model response is complete and returns the message response.

POST/v2/chats/{chatId}/messages

Usage

TypeScript Example
import { v0 } from 'v0-sdk'const result = await v0.messages.send({  chatId: 'chat_abc123',  message: 'Hello, world!',})console.log(result)

API Signature

Request

Path Parameters

chatId: string

The unique identifier of the chat.

Request Body

message: string

The prompt or instruction to send to the model.

systemPrompt?: string

System-level context for the chat, such as frameworks or development environment details.

modelConfiguration?: object

Overrides for the model behavior.

modelId: 'v0-auto' | 'v0-mini' | 'v0-pro' | 'v0-max' | 'v0-max-fast'

Model to use for the generation.

imageGenerations: boolean

Enables image generations to generate up to 5 images per version.

mcpServerIds?: string[]

MCP server IDs to enable. When omitted, uses default enabled servers.

attachments?: object[]

Files or assets to include with the message.

url: string

URL of the attachment.

skillIds?: string[]

Skill IDs (from skills.sh) to attach. Skills provide domain-specific knowledge to the AI. Maximum 3.

action?: object

An optional action. Use fix-with-v0 to trigger automatic error fixing — the message should contain the error context.

type: 'fix-with-v0'

Response

id: string

Unique message identifier.

chatId: string

ID of the chat this message belongs to.

role: 'user' | 'assistant'

Who produced this message.

createdAt: string

ISO timestamp when the message was created.

updatedAt: string

ISO timestamp when the message was last updated.

content: string

The trailing prose of the message — the agent’s closing summary, or the user’s message text. Empty string when there is no closing prose.

parts: ('text' | 'thinking' | 'file-read' | 'file-edit' | 'search' | 'bash' | 'tool-call' | 'agent-action')[]

Ordered list of parts that make up the message. Iterate to render the full narrative including thinking, file operations, tool calls, and prose.

type: 'text'

A block of text output by the agent.

text: string

Markdown prose written by the agent or user.

startedAt?: string

ISO timestamp when this part began.

finishedAt?: string

ISO timestamp when this part completed.

finishReason: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | null

Why generation ended. Null while the agent is still generating; once non-null, the message is final and safe to consume.

attachments?: object[]

Files attached to this message.

url: string

URL to the attachment.

name?: string

Original filename, when available.

contentType?: string

MIME type.

size?: integer

Size in bytes.

authorId: string | null

ID of the user who authored a user message; null for assistant messages.

usage: object

Token usage and credit cost. All values are zero on user messages and on assistant messages that have not yet generated tokens.

tokens: object

Token counts for this message.

input: number

Prompt input value (non-cached).

output: number

Completion output value.

cacheRead: number

Cache-read input value.

cacheWrite: number

Cache-write input value.

total: number

Sum of input, output, cacheRead, and cacheWrite.

creditsCost: object

Credit cost for this message.

input: number

Prompt input value (non-cached).

output: number

Completion output value.

cacheRead: number

Cache-read input value.

cacheWrite: number

Cache-write input value.

total: number

Sum of input, output, cacheRead, and cacheWrite.

On this page